# 响应首行响应头
import socket

sock = socket.socket()

sock.bind(("127.0.0.1", 8000))
sock.listen(5)
while 1:
    conn, addr = sock.accept()
    data = conn.recv(1024)
    print("客户端发送的请求消息：\n", data)
    conn.send(b"HTTP/1.1 200 OK\r\nserver:yuan\r\ncontent-type:text/html\r\n\r\n<h1>hello world<h1>")
    conn.close()
